<!-- 实现父子组件的传值 -->
<template>
    <div>
        <h2>
            {{msg}}
        </h2>
        <button @click="setData">点击我改变父组件标题</button>
        <span>---</span>
        <button @click="setOtherData">再次点击我</button>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                t1: "子组件改变了父组件的标题",
                t2: "我又再次改变了标题"
            }
        },
        name: "TestProp",
        props:["msg"],
        methods: {
            setData: function(){
                this.$emit("changeCtx", this.t1);
            },
            setOtherData: function() {
                this.$emit("changeCtx", this.t2);
            }
        },
    }
</script>


<style>

</style>
